package com.anjho.dao;

import java.io.Serializable;
import java.util.List;

import javax.persistence.Query;

import com.anjho.pojo.City;

public class DAOCity extends DAOGeneric implements Serializable {

	private static final long serialVersionUID = 6522206391994327208L;
	
	public DAOCity() {
		super();
	}

	@SuppressWarnings("unchecked")
	public List<City> getCityList() throws Exception {
		return (List<City>)super.getList("City.getCityList");
	}
	
	public City getCityByZip(String zip) {
		Query query = entityManager.createNamedQuery("City.getCityByZip");
		query.setParameter("zip", zip);
		System.out.println(query.toString());
		City city = (City) query.getSingleResult();
		return city;
	}

}
